//
//  ZJOfflineStudyViewController.m
//  ShangHaiHuDongApp
//
//  Created by ZJ on 2017/7/20.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "ZJOfflineStudyViewController.h"
#import "PartyServiceCenterHeaderView.h"
#import "ZJOSSynopsisViewController.h"
#import "ZJOSCourseViewController.h"
#import "ZJOSTeachersViewController.h"
#import "GTPageController.h"
#import "ShareOrderActServiceViewController.h"
@interface ZJOfflineStudyViewController ()<PartyServiceCenterHeaderDelegate,GTMenuViewDelegate>
{
    GTPageController *_pageController;/**< 首页框架 */
    
}
/**  头部  */
@property (strong, nonatomic) PartyServiceCenterHeaderView  *headerView;

@end

@implementation ZJOfflineStudyViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self setupUI];
}

- (void)setupUI{
    self.titlelabel.text = @"社区党校";
    [self.view addSubview:self.headerView];
    //分割线
    UIView *space = [[UIView alloc]initWithFrame:CGRectMake(0, self.headerView.bottom, self.view.width, 8 * [UIScreen zj_screenHScale])];
    space.backgroundColor = [UIColor themeGrayColor];
    
    [self.view addSubview:space];
    //框架
    _pageController = [self getDefaultController];
    _pageController.view.frame = CGRectMake(0, space.bottom, [UIScreen zj_screenWith], [UIScreen zj_screenHeight] - space.bottom);
    [self.view addSubview:_pageController.view];
    [self addChildViewController:_pageController];
    
}

- (GTPageController *)getDefaultController{
    ZJOSSynopsisViewController *vc1 = [[ZJOSSynopsisViewController alloc]init];
    ZJOSTeachersViewController *vc2 = [[ZJOSTeachersViewController alloc]init];
    ZJOSCourseViewController *vc3 = [[ZJOSCourseViewController alloc]init];
    NSDictionary *dict = [self.model yy_modelToJSONObject];
    
    NSArray *titles = @[@"简介",@"师资",@"课程"];
    NSArray *viewControllers = @[[vc1 class],[vc2 class],[vc3 class]];
    GTPageController *pageVC = [[GTPageController alloc] initWithViewControllerClasses:viewControllers andTheirTitles:titles];
    pageVC.data = @[dict,dict,dict];
    pageVC.pageAnimatable = YES;
    pageVC.postNotification = YES;
    pageVC.menuBGColor = [UIColor whiteColor];
    pageVC.menuViewStyle = GTMenuViewStyleLine;
    pageVC.titleColorNormal = [UIColor zj_colorWithHexString:@"626262"];
    
    return pageVC;
}


#pragma mark - PartyServiceCenterHeaderDelegate 协议方法
- (void)PartyServiceCenterHeaderClickYuYue_button{
    ShareOrderActServiceViewController *vc = [ShareOrderActServiceViewController new];
    ShareOpenListModel *model = [ShareOpenListModel new];
    model.ID = self.model.ID;
    model.RESOURCETYPE = @"1";
    model.TORANG = @"2";
    model.PEOPLE_NUM = @"0";
    vc.model = model;
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark - Setter


#pragma mark - Getters
- (PartyServiceCenterHeaderView *)headerView{
    if (_headerView == nil){
        _headerView = [[PartyServiceCenterHeaderView alloc] initWithFrame:CGRectMake(0, LP_TopHeight, self.view.width, 260 * [UIScreen zj_screenHScale])];
        _headerView.delegate = self;
        _headerView.schoolModel = self.model;
    }
    return _headerView;
}

@end
